ci: impute a weight for new PostgreSQL tests instead of refusing them - #821
Merged
Merged
Conversation
#815 packs the PostgreSQL shards by measured duration and fails closed on any workflow entry with no `measured_seconds`. Weights are harvested from `cargo-postgres-timing:` lines in a FINISHED CI log, so a test that has never run cannot have a measurement -- and it cannot run until its PR is green. The guard therefore made every new PostgreSQL test unmergeable. #802 is the first one to hit it: 1 workflow entr(ies) have no measured_seconds; regenerate weights before trusting the balance: ontology-canonical-adapter-postgres-employment-reassign-as-runtime-role-pg That guard was written for a different failure: a map that has DRIFTED, where entries silently lost weights they once had. Both look identical to a per-entry check, but they differ by scale -- a PR adds one or two, a bad regeneration drops dozens -- so the distinction is now made on share. - Unmeasured entries are imputed at the mean of their OWN package where it has a measured sibling (a new suite usually resembles the suite it joins), and the global mean otherwise. Never 0: a free entry lands in the lightest bin, which is exactly where a heavy newcomer hurts most, and treating unmeasured as free is how the entry-count scheme drifted in the first place. - Above MAX_UNMEASURED_SHARE (10%) the map is treated as drifted and still fails closed. At the observed 209 entries that allows 20 -- far more than any PR adds, far fewer than a regeneration that lost its timings. - A map with NO measurement anywhere fails closed separately: there is no basis to impute from, and imputing from nothing would invent a balance nobody measured. - Imputation bases are computed over measured entries only, so an imputed value never feeds back into the mean used to weigh the next one. - The CLI names every imputed entry and the total seconds it added, so an estimate is visible and gets replaced at the next timings harvest rather than hardening into a fake measurement. Measured on #802's exact case: imputed 35.4s from its package mean, partition ok, 5 shards, spread 1.00x, exit 0. Mutation-proven on the real 209-entry map: strip 15% of measurements -> exit 1, "14.8%, limit 10%, the map has drifted"; strip every measurement -> exit 1, "no basis to impute from"; one new entry (the #802 shape) -> exit 0, imputed and named. 26 partition tests pass; 12 gates swept, 0 failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
#815 packs the PostgreSQL shards by measured duration and fails closed on any workflow entry with no
measured_seconds. But weights are harvested fromcargo-postgres-timing:lines in a finished CI log — so a test that has never run cannot have a measurement, and it cannot run until its PR is green.Every new PostgreSQL test is currently unmergeable. #802 is the first to hit it:
Why the guard was still right, and what changes
That guard was written for a different failure — a map that has drifted, where entries silently lost weights they once had. Both look identical to a per-entry check. They differ by scale: a PR adds one or two, a bad regeneration drops dozens. So the distinction is now made on share.
Measured on #802's exact case
Mutation-proven on the real 209-entry map
26 partition tests pass; 12 gates swept, 0 failed; cargo-map, dark-suites and executed-tests-baseline all exit 0.
Unblocks
#802, and every future PostgreSQL test.
🤖 Generated with Claude Code